]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
popupMenu: Introduce a way of closing toplevels from sections
authorJasper St. Pierre <jstpierre@mecheye.net>
Tue, 18 Jun 2013 08:46:44 +0000 (04:46 -0400)
committerJasper St. Pierre <jstpierre@mecheye.net>
Mon, 15 Jul 2013 16:01:07 +0000 (12:01 -0400)
As the aggregate menu will be built out of sections from each
of the menus, we need to ensure that activating an item in one
of these sections can close the main menu, even when it is not
a menu item. The new API also needs to be flexible enough to
ensure that animations can be controlled, like the buttons that
lock the screen or launch a new session.

Port the user menu to use this new API as well.

https://bugzilla.gnome.org/show_bug.cgi?id=702539

js/ui/popupMenu.js
js/ui/userMenu.js

index b0d219f5a9d78807aa1df12353ae61fbd9d9a10e..b5b156db6ef34cc6563f65230b203a6fcc13786c 100644 (file)
@@ -754,6 +754,13 @@ const PopupMenuBase = new Lang.Class({
         return false;
     },
 
+    itemActivated: function(animate) {
+        if (animate == undefined)
+            animate = BoxPointer.PopupAnimation.FULL;
+
+        this._getTopMenu().close(animate);
+    },
+
     /**
      * _connectSubMenuSignals:
      * @object: a menu item, or a menu section
@@ -800,7 +807,7 @@ const PopupMenuBase = new Lang.Class({
         }));
         menuItem._activateId = menuItem.connect('activate', Lang.bind(this, function (menuItem, event) {
             this.emit('activate', menuItem);
-            this.close(BoxPointer.PopupAnimation.FULL);
+            this.itemActivated(BoxPointer.PopupAnimation.FULL);
         }));
         // the weird name is to avoid a conflict with some random property
         // the menuItem may have, called destroyId
index 86980c5a648a08cf38cc869252b4615b943294b9..68a300a4d6d01428ce694dda1fa04242eca8a3ff 100644 (file)
@@ -803,13 +803,13 @@ const UserMenuButton = new Lang.Class({
     },
 
     _onLockScreenActivate: function() {
-        this.menu.close(BoxPointer.PopupAnimation.NONE);
+        this.menu.itemActivated(BoxPointer.PopupAnimation.NONE);
         Main.overview.hide();
         Main.screenShield.lock(true);
     },
 
     _onLoginScreenActivate: function() {
-        this.menu.close(BoxPointer.PopupAnimation.NONE);
+        this.menu.itemActivated(BoxPointer.PopupAnimation.NONE);
         Main.overview.hide();
         if (Main.screenShield)
             Main.screenShield.lock(false);
@@ -937,7 +937,7 @@ const UserMenuButton = new Lang.Class({
                         this._session.ShutdownRemote();
             }));
         } else {
-            this.menu.close(BoxPointer.PopupAnimation.NONE);
+            this.menu.itemActivated(BoxPointer.PopupAnimation.NONE);
             this._loginManager.suspend();
         }
     }